<?php
namespace admin\Controller;
use Think\Controller;
class OrderController extends Controller {
    /**确认收货模块
     **接受参数： 用户ID$book_sh_user 订单编号$book_dd
     **BookLog_action 0为已发货 1为收货  2为退货中  3为已退货
     **/
    public function book_sh($json)
    {
        $sh_json = json_decode($json,true);
        $book['users_user_id'] = $sh_json[users_user_id];//
        $book['book_dd'] = $sh_json[book_dd];
        $booklogs = M('booklogs');
        if ($booklogs->where($book)->select()) {                                            //判断订单与用户是否匹配
            $rs = $booklogs->where($book)->getfield('booklog_action');
            //  判断订单状态
            if ($rs == 0) {                                               //  '已发货,未收货'
                $booklogs->where($book)->setField('BookLog_action', '1');
            }
            elseif ($rs == 1) {
                echo '已收货';
            }
//            elseif ($rs[0][booklog_action] == 2) {
//                echo '退货中';
//            }
//            elseif ($rs[0][booklog_action] == 3) {
//                echo '已退货';
//            }
        } else {
            echo '订单不存在！！！';
        }
    }
}